<?php

namespace App\Library\Console\Commands;

use App\Exports\Sheet\OneSheetExport;
use Illuminate\Console\Command;
use Maatwebsite\Excel\Facades\Excel;

class DemoExportCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'app:demo-export';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * handle
     * @return void
     */
    public function handle(): void
    {
        $file = now()->format('Y-m-d-H-i-s') . '.xlsx';
        Excel::store(new OneSheetExport('demo-export'), $file);
    }
}
